package com.qijian.quality.domain.query;


import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.util.List;
import java.util.Set;


/**
 * 管理流程数据对象 查询条件类
 *
 * @author qijian
 * @date 2022-04-06
 */

@Data
@ToString
@TableName("qm_flowable_data")
public class FlowableDataQuery {

    @WhereType(filed = "id", sort = true)
    private Long id;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "type")
    private String type;
    @WhereType(filed = "data")
    private String data;
    @WhereType(filed = "status")
    private Integer status;
    @WhereType(filed = "status", type = WhereTypeEnum.NEQ)
    private Integer statusNeq;

    @WhereType(filed = "data", jsonKey = "remark", type = WhereTypeEnum.LIKE)
    private String dataRemark;

    @WhereType(filed = "data", jsonKey = "title", type = WhereTypeEnum.LIKE)
    private String title;

    @WhereType(filed = "data", jsonKey = "projectMachineNo", type = WhereTypeEnum.LIKE)
    private String projectMachineNo;

    @WhereType(filed = "data", jsonKey = "projectNo", type = WhereTypeEnum.LIKE)
    private String projectNo;

    @WhereType(filed = "data", jsonKey = "projectName", type = WhereTypeEnum.LIKE)
    private String projectName;

    @WhereType(filed = "data", jsonKey = "code", type = WhereTypeEnum.LIKE)
    private String ncrCode;

    @WhereType(filed = "data", jsonKey = "cunType", type = WhereTypeEnum.LIKE)
    private String cunType;

    @WhereType(filed = "data", jsonKey = "cunType", type = WhereTypeEnum.IN)
    private List<String> cunTypeList;

    @WhereType(filed = "data", jsonKey = "code", type = WhereTypeEnum.LIKE)
    private String dataCode;

    @WhereType(filed = "create_by", type = WhereTypeEnum.LIKE)
    private String createBy;

    @WhereType(filed = "create_id")
    private Long createIdLong;

    @WhereType(fields = {"qm_flowable_data.create_id", "qm_flowable_user.user_id"})
    private Long createId;

    @WhereType(filed = "user_id", tableName = "qm_flowable_user")
    private Long userId;

    @WhereType(filed = "sort", tableName = "qm_flowable_user")
    private Integer userSort;

    @WhereType(filed = "data", tableName = "qm_flowable_data", func = "JSON_UNQUOTE(data -> '$.remark') like concat('%', {1}, '%')")
    private String remark;

    @WhereType(filed = "data", func = "JSON_UNQUOTE(data -> '$.desc') like concat('%', {1}, '%')")
    private String safeCheckDesc;

    @WhereType(filed = "data", func = "JSON_UNQUOTE(data -> '$.checkBy') like concat('%', {1}, '%')")
    private String safeCheckCheckBy;

    @WhereType(func = "date_format(qm_flowable_data.create_time,'%Y-%m') = {1}")
    private String createYearMonth;

    @WhereType(filed = "data", jsonKey = "projectNo", type = WhereTypeEnum.IN)
    private List<String> projectNosIn;

    @WhereType(filed = "data", jsonKey = "projectNo", type = WhereTypeEnum.NEQ)
    private String projectNoNeq;

    @WhereType(filed = "data", jsonKey = "projectNo", type = WhereTypeEnum.NOTNULL)
    private Boolean projectNoNotNull;

    @WhereType(filed = "data", jsonKey = "projectMachineNo", type = WhereTypeEnum.NOTNULL)
    private Boolean projectMachineNoNotNull;

}
